
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.net.URL;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Mikael Köhlmyr | mikael@kohlmyr.com | http://www.kmyr.net
 */
public class mklib {
     public static void echo(String out){
        System.out.println(out);
    }
     
    public static void echo(int out){
        System.out.println(out);
    }

    public static XMLStreamReader getXMLStream(String file) throws XMLStreamException, FileNotFoundException{
            /*
            **   http://download.oracle.com/javase/6/docs/api/javax/xml/stream/XMLStreamReader.html
            */
            XMLInputFactory factory = XMLInputFactory.newInstance();
            FileInputStream fileStream = new FileInputStream(file);
            XMLStreamReader xmls = factory.createXMLStreamReader(fileStream);
            return xmls;
    }

    public static String urlReader(String link) throws IOException{
        String str;
        String contents = "";
        URL url = new URL(link);
        BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
        while ((str = in.readLine()) != null) {
            contents += str;
        }
        in.close();
        return contents;
    }
}
